package edu.sdjzu.exam.service.rocketmq;


import edu.sdjzu.exam.domain.exam.ExamAnswer;
import edu.sdjzu.exam.dto.ExamAnswerSubmitDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class ExamResultProducer {
    private final RocketMQTemplate rocketMQTemplate;

    public void sendExamResult(ExamAnswer examAnswer) {
        String topic = "exam-result-topic";
        String tag = "submit";
        String destination = topic + ":" + tag;

        rocketMQTemplate.convertAndSend(destination, examAnswer);
        log.info("发送考试结果成功: {}", examAnswer);
    }
}
